﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ThaiHoa.Win.QLSX.SanXuat.UI;

namespace ThaiHoa.Win.QLSX.SanXuat
{
    public class Access
    {
        #region Fields
        Form form;
        #region Detail
        frmCongDoanSanXuatDetail _frmCongDoanSanXuatDetail;
        frmBoPhanDetail _frmBoPhanDetail;
        frmCongNhanDetail _frmCongNhanDetail;
        frmDayChuyenDetail _frmDayChuyenDetail;
        frmLoaiCongNhanDetail _frmLoaiCongNhanDetail;
        frmDoiSanXuatDetail _frmDoiSanXuatDetail;
        #endregion
        #region List
        frmCongDoanSanXuatList _frmCongDoanSanXuatList;
        frmBoPhanList _frmBoPhanList;
        frmCongNhanList _frmCongNhanList;
        frmDayChuyenList _frmDayChuyenList;
        frmLoaiCongNhanList _frmLoaiCongNhanList;
        frmDoiSanXuatList _frmDoiSanXuatList;
        #endregion
        #endregion
        #region Show Form Detail
        //Công đoạn sản xuất
        public void ShowFormCongDoanSanXuatDetail(Guid Id)
        {
            _frmCongDoanSanXuatDetail = new frmCongDoanSanXuatDetail();
            _frmCongDoanSanXuatDetail.Id = Id;
            _frmCongDoanSanXuatDetail.ShowDialog();
        }
        public void ShowFormCongDoanSanXuatDetail(frmCongDoanSanXuatDetail item, Guid Id)
        {
            item.Id = Id;
            item.ShowDialog();
        }
        //Bộ phận
        public void ShowFormBoPhanDetail(Guid Id)
        {
            _frmBoPhanDetail = new frmBoPhanDetail();
            _frmBoPhanDetail.Id = Id;
            _frmBoPhanDetail.ShowDialog();
        }
        public void ShowFormBoPhanDetail(frmBoPhanDetail item, Guid Id)
        {
            item.Id = Id;
            item.ShowDialog();
        }
        //Công nhân
        public void ShowFormCongNhanDetail(Guid Id)
        {
            _frmCongNhanDetail = new frmCongNhanDetail();
            _frmCongNhanDetail.Id = Id;
            _frmCongNhanDetail.ShowDialog();
        }
        public void ShowFormCongNhanDetail(frmCongNhanDetail item, Guid Id)
        {
            item.Id = Id;
            item.ShowDialog();
        }
        //Dây chuyền
        public void ShowFormDayChuyenDetail(Guid Id)
        {
            _frmDayChuyenDetail = new frmDayChuyenDetail();
            _frmDayChuyenDetail.Id = Id;
            _frmDayChuyenDetail.ShowDialog();
        }
        public void ShowFormDayChuyenDetail(frmDayChuyenDetail item, Guid Id)
        {
            item.Id = Id;
            item.ShowDialog();
        }
        //Loại công nhân
        public void ShowFormLoaiCongNhanDetail(Guid Id)
        {
            _frmLoaiCongNhanDetail = new frmLoaiCongNhanDetail();
            _frmLoaiCongNhanDetail.Id = Id;
            _frmLoaiCongNhanDetail.ShowDialog();
        }
        public void ShowFormLoaiCongNhanDetail(frmLoaiCongNhanDetail item, Guid Id)
        {
            item.Id = Id;
            item.ShowDialog();
        }
        //Đội sản xuất
        public void ShowFormDoiSanXuatDetail(Guid Id)
        {
            _frmDoiSanXuatDetail = new frmDoiSanXuatDetail();
            _frmDoiSanXuatDetail.Id = Id;
            _frmDoiSanXuatDetail.ShowDialog();
        }
        public void ShowFormDoiSanXuatDetail(frmDoiSanXuatDetail item, Guid Id)
        {
            item.Id = Id;
            item.ShowDialog();
        }

        #endregion
        #region Show Form List
        public void ShowFormCongDoanSanXuatList()
        {
            if (_frmCongDoanSanXuatList == null || _frmCongDoanSanXuatList.IsDisposed)
            {
                _frmCongDoanSanXuatList = new frmCongDoanSanXuatList();
                _frmCongDoanSanXuatList.MdiParent = form;
                _frmCongDoanSanXuatList.WindowState = FormWindowState.Maximized;
                _frmCongDoanSanXuatList.Show();
            }
            else
            {
                _frmCongDoanSanXuatList.Activate();
            }
        }
        public void ShowFormBoPhanList()
        {
            if (_frmBoPhanList == null || _frmBoPhanList.IsDisposed)
            {
                _frmBoPhanList = new frmBoPhanList();
                _frmBoPhanList.MdiParent = form;
                _frmBoPhanList.WindowState = FormWindowState.Maximized;
                _frmBoPhanList.Show();
            }
            else
            {
                _frmBoPhanList.Activate();
            }
        }
        public void ShowFormCongNhanList()
        {
            if (_frmCongNhanList == null || _frmCongNhanList.IsDisposed)
            {
                _frmCongNhanList = new frmCongNhanList();
                _frmCongNhanList.MdiParent = form;
                _frmCongNhanList.WindowState = FormWindowState.Maximized;
                _frmCongNhanList.Show();
            }
            else
            {
                _frmCongNhanList.Activate();
            }
        }
        public void ShowFormDayChuyenList()
        {
            if (_frmDayChuyenList == null || _frmDayChuyenList.IsDisposed)
            {
                _frmDayChuyenList = new frmDayChuyenList();
                _frmDayChuyenList.MdiParent = form;
                _frmDayChuyenList.WindowState = FormWindowState.Maximized;
                _frmDayChuyenList.Show();
            }
            else
            {
                _frmDayChuyenList.Activate();
            }
        }
        public void ShowFormLoaiCongNhanList()
        {
            if (_frmLoaiCongNhanList == null || _frmLoaiCongNhanList.IsDisposed)
            {
                _frmLoaiCongNhanList = new frmLoaiCongNhanList();
                _frmLoaiCongNhanList.MdiParent = form;
                _frmLoaiCongNhanList.WindowState = FormWindowState.Maximized;
                _frmLoaiCongNhanList.Show();
            }
            else
            {
                _frmLoaiCongNhanList.Activate();
            }
        }
        public void ShowFormDoiSanXuatList()
        {
            if (_frmDoiSanXuatList == null || _frmDoiSanXuatList.IsDisposed)
            {
                _frmDoiSanXuatList = new frmDoiSanXuatList();
                _frmDoiSanXuatList.MdiParent = form;
                _frmDoiSanXuatList.WindowState = FormWindowState.Maximized;
                _frmDoiSanXuatList.Show();
            }
            else
            {
                _frmDoiSanXuatList.Activate();
            }
        }
        #endregion

        public Access(Form newForm)
        {
            form = newForm;
        }
        public Access()
        {
        }
    }
}
